//
/***********************************************************
             File name:      main.c
             Author:         Bitat (陆叁柒)
             Email :         Bitat@qq.com
             Gitee :         https://gitee.com/bitat
             CSDN  :         https://blog.csdn.net/bitat
             History:        2023/2/12
 ************************************************************/

#include <stdio.h>

int DigitSum(int x)
{
    if (x > 9)
    {
        return (x % 10 + DigitSum(x / 10));
    }
    else
    {
        return x;
    }
}

int main()
{
    int n = 0;

    scanf("%d", &n);
    int ret = DigitSum(n);
    printf("%d\n", ret);
    
    return 0;
}
